﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace QuestPrototype.Menus
{
    class MenuGFX
    {
        public static void DrawMenuGFX(Rectangle dest , Color clrColor , bool bg , SpriteBatch sb  , Texture2D t2d , double bgAlpha = 0.99)
    {
    int  srcImgWidth  = 16;
        int srcImgHeight  = 16;
        Rectangle sRect  ;
        Rectangle dRect  ;
        Color dColor  = clrColor;

            if (bg == true)
	{
		 sRect = new Rectangle(0, 0, 64, 32);
            dRect = new Rectangle(dest.X + 3, dest.Y + 3, dest.Width - 6, dest.Height - 6);
            sb.Draw(t2d, dRect, sRect, dColor);
	}

            // top left corner
        sRect = new Rectangle(64, 0, srcImgWidth, srcImgHeight);
        dRect = new Rectangle(dest.X, dest.Y, srcImgWidth, srcImgHeight);
        sb.Draw(t2d, dRect, sRect, dColor);

            // top middle
        sRect = new Rectangle(80, 0, srcImgWidth, srcImgHeight);
        dRect = new Rectangle(dest.X + srcImgWidth, dest.Y, dest.Width - (srcImgWidth * 2), srcImgHeight);
        sb.Draw(t2d, dRect, sRect, dColor);

        // top right corner
        sRect = new Rectangle(112, 0, srcImgWidth, srcImgHeight);
        dRect = new Rectangle(dest.X + dest.Width - srcImgWidth, dest.Y, srcImgWidth, srcImgHeight);
        sb.Draw(t2d, dRect, sRect, dColor);

        // left side
        sRect = new Rectangle(64, 16, srcImgWidth, srcImgHeight);
        dRect = new Rectangle(dest.X, dest.Y + srcImgHeight, srcImgWidth, dest.Height - (srcImgHeight * 2));
        sb.Draw(t2d, dRect, sRect, dColor);

        // right side
        sRect = new Rectangle(112, 16, srcImgWidth, srcImgHeight);
        dRect = new Rectangle(dest.X + dest.Width - srcImgWidth, dest.Y + srcImgHeight, srcImgWidth, dest.Height - (srcImgHeight * 2));
        sb.Draw(t2d, dRect, sRect, dColor);

        // bottom left corner
        sRect = new Rectangle(64, 48, srcImgWidth, srcImgHeight);
        dRect = new Rectangle(dest.X, dest.Y + dest.Height - srcImgHeight, srcImgWidth, srcImgHeight);
        sb.Draw(t2d, dRect, sRect, dColor);

        // bottom middle
        sRect = new Rectangle(80, 48, srcImgWidth, srcImgHeight);
        dRect = new Rectangle(dest.X + srcImgWidth, dest.Y + dest.Height - srcImgHeight, dest.Width - (srcImgWidth * 2), srcImgHeight);
        sb.Draw(t2d, dRect, sRect, dColor);

        // bottom right corner
        sRect = new Rectangle(112, 48, srcImgWidth, srcImgHeight);
        dRect = new Rectangle(dest.X + dest.Width - srcImgWidth, dest.Y + dest.Height - srcImgHeight, srcImgWidth, srcImgHeight);
        sb.Draw(t2d, dRect, sRect, dColor);

    }

    }
}
